/*
 * @Author: wsf
 * @Date: 2019-02-20 16:14:19
 * @LastEditors: wsf
 * @Description: 
 */
 export default function getDataSource(props){
	let {dispatch,fd:{config,formData={}},dataset_key,formDataKey,pager,callback,model="form",ds,component_type}=props;
	if(!config){
		return
	}
	let {datasets}=config;
	let list_config;
	if(ds){//把配置传过来，就不需要去datasets中去取了。
		list_config=ds
	}
	else{
		list_config=datasets[dataset_key]
	}
	
	if(list_config){
		let {api:apiInfo,source_type,options}=list_config;
		dispatch({
			type:model+"/getDataSource",
			payload:{
				component_type,
				...list_config,
				apiInfo,
				pager,
				data:formData,
				dataset_key,
				options,
				source_type,
				formDataKey,
				callback
			}
		})
	}
	else{
		console.log("未配置数据源",dataset_key);
	}
}